package com.zh.constants;


import java.util.Arrays;
import java.util.List;

//常量维护
public class Constants {

    /**
     * 手机号正则表达式
     */
    public static final String CHINA_PHONE_REGEX = "^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|" +
            "(18[0-9])|(19[0-3,5-9]))\\d{8}$";
    /**
     * 邮箱正则表达式
     */
    public static final String CHINA_EMAIL_REGEX = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";

    /**
     * 编码
     */
    public static final String UTF_8 = "UTF-8";

    /**
     * 实名审核
     */
    public class RealAuth {

        /**
         * 等待审核
         */
        public static final int STATUS_WAIT_AUDIT = 0;
        /**
         * 审核通过
         */
        public static final int STATUS_AUDIT_SUCCESS = 1;
        /**
         * 审核驳回(失败)
         */
        public static final int STATUS_AUDIT_FAIL = 2;
        public static final Boolean STATUS_PASS = true;
        public static final Boolean STATUS_REJECT = false;
    }

    public class Lock {
        /**
         * 根据订单号加锁
         */
        public static final String UPDATE_ORDERNO_KEY = "lock:orderNo:%s";
        public static final String KILL_ORDERNO_KEY = "lock:killOrderNo:%s";
        public static final String PAY_ORDER_KEY = "lock_payOrderNO_result:%s";
    }

    //注册中心 Login
    public class Login {
        /**
         * 初始化头像
         */
        public static final String AVATAR_ADDRESS = "https://img1.baidu.com/it/u=3387871259," +
                "1653657207&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400";
        /**
         * 管理员 name
         */
        public static final String ADMIN_NAME = "管理员";
        /**
         * 初始管理员账号
         */
        public static final String ADMIN_USERNAME = "admin";
        /**
         * 初始密码
         */
        public static final String ADMIN_PASSWORD = "123456";
        /**
         * 平台账户类型
         */
        public static final int TYPE_ADMIN = 0;
        /**
         * 司机类型
         */
        public static final int TYPE_DRIVER = 1;
        /**
         * 乘客类型
         */
        public static final int TYPE_CUSTOMER = 2;
    }

    //远程调用
    public class Remote {
        //服务名
        public static final String SERVICE_UAA = "fccar-service-uaa";
        public static final String SERVICE_CUSTOMER = "fccar-service-customer";
        public static final String SERVICE_BIGDATA = "fccar-service-bigdata";
        public static final String SERVICE_DRIVER = "fccar-service-driver";

        public static final String PREFIX_LOGIN_REMOTE = "/login/remote";
    }

    // reids
    public class Redis {
        /**
         * 权限列表的key
         */
        public static final String PERMISSIONS_KEY = "permissions:%s";

        /**
         * 用户基本信息
         */
        public static final String LOGIN_INFO_KEY = "login:info:%s";
        /**
         * 司机配置
         */
        public static final String DRIVER_SETTING_KEY = "driver:setting:%s";
        /**
         * 司机位置 -GEO
         */
        public static final String DRIVER_GEO_KEY = "driver:geo";
        /**
         * 订单缓存到Redis中
         */
        public static final String ORDER_KEY = "order_orderNo:%s";
        /**
         * 分布锁 -订单-前缀
         */
        public static final String KEY_LOCK_ORDER_KILL = "lock_order_kill:%s";
        /**
         * 支付结果 - 加锁
         */
        public static final String KEY_LOCK_PAY_RESULT = "lock_pay_result:%s";
        /**
         * 缓存司机坐标、订单号、订单状态
         */
        public static final String DRIVER_LOCATION = "driver:location:%s";
        /**
         * 订单服务-处理支付结果
         */
        public static final String KEY_LOCK_ORDER_PAY_RESULT = "lock_order_pay_result:%s";
        /**
         * 支付服务-创建支付单
         */
        public static final String KEY_LOCK_PAY_ORDER_CREATE = "lock_pay_order_create:%s";


    }

    /**
     * 会员等级
     */
    public class Level {
        /**
         * 青铜
         */
        public static final String LEVEL_ZERO = "0";
        /**
         * 白银
         */
        public static final String LEVEL_ONE = "1";
        /**
         * 黄金
         */
        public static final String LEVEL_TWO = "2";
        /**
         * 铂金
         */
        public static final String LEVEL_THREE = "3";
        /**
         * 大师
         */
        public static final String LEVEL_FOUR = "4";
        /**
         * 宗师
         */
        public static final String LEVEL_FIVE = "5";
        /**
         * 王者
         */
        public static final String LEVEL_SIX = "6";

    }

    /**
     * 支付状态 ： 0：待支付 1.支付中 2：支付成功
     */
    public class pay {
        /**
         * 支付消息
         */
        public static final int MESSAGE_TYPE_PAY = 1;

        /**
         * 待支付
         */
        public static final int PAY_STATUS_WAIT = 0;

        /**
         * 支付中
         */
        public static final int PAY_STATUS_LOADING = 1;
        /**
         * 已支付
         */
        public static final int PAY_STATUS_SUCCESS = 2;
    }

    /**
     * 支付方式:0余额直接，1微信，2支付宝,3银联
     */
    public class payType {
        /**
         * 余额支付（钱包支付）
         */
        public static final int PAY_TYPE_WALLET =0 ;
        /**
         * 微信
         */
        public static final int PAY_TYPE_WX = 1;

        /**
         * 支付宝
         */
        public static final int PAY_TYPE_ZFB = 2;
        /**
         * 银联
         */
        public static final int PAY_TYPE_YIN_LIAN = 3;
    }
    /**
     * 订单账单表
     */
    public class Bill {

        /**
         * 分账状态 : 未分账
         */
        public static final int SHARING_STATUS_ZERO = 0;

        /**
         * 分账状态已分账
         */
        public static final int SHARING_STATUS_ONE = 1;
    }

    /**
     * 订单相关
     * /*========================================================================================
     * *  0等待接单，1已接单，2司机已到达，3开始代驾，4结束代驾，5.司机确认费用，6未付款，
     * 7已付款，8订单已结束，9顾客撤单，10司机撤单，11事故关闭，12其他
     * *=======================================================================================*
     */
    public class Order {

        /**
         * 等待接单 -0
         */
        public static final int ORDER_STATUS_WAIT = 0;
        /**
         * 已接单 -1
         */
        public static final int ORDER_STATUS_ACCEPTED = 1;
        /**
         * 司机到达-2
         */
        public static final int ORDER_STATUS_ARRIVE = 2;
        /**
         * 开始代驾-3
         */
        public static final int ORDER_STATUS_START_DRIVING = 3;
        /**
         * 结束代驾 -4
         */
        public static final int ORDER_STATUS_COMPLETE_DRIVED = 4;
        /**
         * 司机确认费用- 5
         */
        public static final int ORDER_STATUS_ENSURE = 5;
        /**
         * 未付款 - 6
         */
        public static final int ORDER_STATUS_NOT_PAY = 6;
        /**
         * 已付款- 7
         */
        public static final int ORDER_STATUS_PAYED = 7;
        /**
         * 订单已结束 - 8
         */
        public static final int ORDER_STATUS_FINISH_ORDER = 8;
        /**
         * 顾客撤单 - 9
         */
        public static final int ORDER_STATUS_CUSTOMER_CANCEL_ORDER = 9;
        /**
         * 司机取消 - 10
         */
        public static final int ORDER_STATUS_DRIVER_CANCEL_ORDER = 10;
        /**
         * 事故关闭 - 11
         */
        public static final int ORDER_STATUS_ACCIDENT_CLOSE = 11;
        /**
         * 其他 -12
         */
        public static final int ORDER_STATUS_OTHER = 12;

        /**
         * 乘客进行中的订单状态集合
         */
        public static final List<Integer> ORDER_STATUS_IN_PROCESS = Arrays.asList(
                ORDER_STATUS_WAIT, ORDER_STATUS_ACCEPTED,
                ORDER_STATUS_ARRIVE, ORDER_STATUS_START_DRIVING,
                ORDER_STATUS_COMPLETE_DRIVED,
                ORDER_STATUS_ENSURE, ORDER_STATUS_NOT_PAY
        );
        /**
         * 司机进行中的状态
         */
        public static final List<Integer> ORDER_STATUS_IN_PROCESS_FOR_DRIVER = Arrays.asList(
                ORDER_STATUS_ACCEPTED,
                ORDER_STATUS_ARRIVE,
                ORDER_STATUS_START_DRIVING,
                ORDER_STATUS_COMPLETE_DRIVED,
                ORDER_STATUS_ENSURE
        );

        /**
         * 可以被取消的订单状态 集合
         */
        public static final List<Integer> ORDER_STATUS_CAN_CANCEL = Arrays.asList(
                ORDER_STATUS_WAIT,
                ORDER_STATUS_ACCEPTED,
                ORDER_STATUS_ARRIVE
        );

    }

    /**
     * 乘客罚款状态
     */
    public class Customer {
        /**
         * 未缴纳
         */
        public static final int FINE_STATUS_UNPAID = 0;
        /**
         * 已缴纳
         */
        public static final int FINE_STATUS_PAY = 1;
    }

    public class MQ {
        //推送订单给司机
        public static final String TOPIC_ORDER = "TOPIC_ORDER";
        public static final String TAGS_ORDER_DRIVER_ID = "tags_order_driverId-%s";

        //MQ事务 - 监听器名字
        public static final String TX_GROUP_PAY_ORDER = "tx_group_pay_order";
        public static final String TX_GROUP_PAY_ORDER_RESULT = "tx_group_payOrder_result";

        public static final String TOPIC_PAY_ORDER = "topic_pay_order";
        public static final String TAGS_PAY_ORDER = "tags_pay_order";

        public static final String TOPIC_PAY_RESULT = "topic_pay_result";
        public static final String TAGS_PAY_RESULT = "tags_pay_result";
        // 消费者
        public static final String CONSUMER_GROUP_PAY_ORDER = "consumer_group_payOrder";
        public static final String CONSUMER_GROUP_PAY_ORDER_RESULT = "consumer_group_payOrder_result";

    }


}
